<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.sql.*" %>
<%@page import="org.edu.system.DBConnect" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<% 
try{
String id = request.getParameter("id");//获取上个页面传来的id 
//out.println(id);
String sql_select = "SELECT * FROM student WHERE stu_id = '" + id + "'";
Connection con = DBConnect.getCon();
request.setCharacterEncoding("utf-8");
System.out.println(sql_select);

PreparedStatement pst = con.prepareStatement(sql_select);
ResultSet rs = pst.executeQuery();
System.out.println(pst);
System.out.println(rs);
if(rs.next()){
	//out.println(id);

%>


		<form action="UpdateServlet?dataBase=edu_system&tableName=student" >
			<table align="center" border="1" width="50%" cellpadding="6" class="table table-striped table-bordered">  
     <tr>
         <th colspan="2" align="center" >更改信息</th><%--th加粗， cellpadding和android padding含义一样--%>
    </tr>
    <tr>
        <td align="center" >*学生学号：</td>   
        <td align="left" ><input type="text" name="ID" value="<%=rs.getString("stu_id") %>"></td>
    </tr>
    <tr>
        <td align="center" >学生姓名：</td> 
         <td align="left" ><input type="text" name="user" value="<%=rs.getString("stu_name") %>"></td>
     </tr>
    <tr>
        <td align="center" >学生密码：</td>
         <td align="left" ><input type="text" name="passwd" value="<%=rs.getString("stu_passwd") %>"></td>
   </tr>
   <tr>
        <td align="center" >学生性别：</td>
         <td align="left" ><select name="gender" class="select">
					<option>男</option>
					<option>女</option>
					<option></option>
				</select></td>
   </tr>
  
       <tr>
        <td align="center" >学生班级：</td>
        <td align="left" ><input type="text" name="class" value="<%=rs.getString("stu_class") %>"></td>
     </tr>
        <tr>
        <td align="center" >课程列表：</td>
        <td align="left" ><input type="text" name="course" value="<%=rs.getString("course_list") %>"></td>
    </tr>
     <tr>
        <td align="center" >手机号：</td>
        <td align="left" ><input type="text" name="phone" value="<%=rs.getString("stu_phone") %>"></td>
    </tr>
    <tr>
        <td align="center" >身份证号：</td>
        <td align="left" ><input type="text" name="identity" value="<%=rs.getString("stu_identity") %>"></td>
    </tr>
    <tr>
        <td align="center" >居住地址：</td>
        <td align="left" ><input type="text" name="location" value="<%=rs.getString("stu_location") %>"></td>
    </tr>
    <tr>
        <td align="center" >全部学分：</td>
        <td align="left" ><input type="text" name="credit" value="<%=rs.getString("total_credit") %>"></td>
    </tr>
   
    <tr>
        <td colspan="2" align="center" ><input type="submit" class="btn btn-success" name="submit" value="保存更新"></td>
     </tr> 
 </table>		
		</form>
	</div>

<%
}
//out.println(id);
} catch (Exception e) {
	out.println(e);
}
%>
</body>
</html>